package service;

import domain.Role;
import domain.Users;
import org.springframework.security.core.userdetails.UserDetailsService;

import java.util.List;

/**
 * @author Freedy
 * @date 2020/12/25 17:08
 */
public interface IUserService extends UserDetailsService {
    /**
     * 查询所有用户
     * @return
     * @throws Exception
     */
    List<Users> findAll() throws Exception;

    /**
     * 保存用户
     * @param users
     * @throws Exception
     */
    void save(Users users) throws Exception;

    /**
     * 根据id查询用户
     * @param id
     * @return
     * @throws Exception
     */
    Users findById(String id) throws Exception;

    /**
     * 查询可用添加的角色
     * @param userId
     * @return
     * @throws Exception
     */
    List<Role> findUserByIdAndAllRole(String userId) throws Exception;

    /**
     * 添加关联
     * @param userId
     * @param roleIds
     * @throws Exception
     */
    void addRoleToUser(String userId, String[] roleIds) throws Exception;
}
